home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / WIN / VB_CTRLS / SPLINES.ZIP / MANUAL.TXT < prev    next >
Encoding:
Text File  |  1993-11-30  |  6.5 KB  |  217 lines

  1. SPLINES.DLL Copyright (c) 1993 by Andrew S. Dean - All rights reserved.
  2.  
  3. SPLINES.DLL is a Windows DLL distributed as shareware.  SPLINES.DLL
  4. can be used from any Windows language or environment which supports
  5. DLL calls.  See the file REGISTER.TXT for information on registration.
  6.  
  7.  
  8.  
  9. SPLINES.DLL is a function library for creating spline curves.
  10. Several types of splines are supported (Bezier splines, B splines,
  11. Beta splines and Tau splines).  Curves can be defined in 2D
  12. or 3D.  All splines in the library are cubic splines.
  13.  
  14.  
  15. Splines are defined by interpolating between a set of distinct
  16. control points.  Both control points and the resulting curves are
  17. stored in arrays of xyzTD structures.  To create a curve, an xyzTD
  18. array of control points is passed to a spline function.  The
  19. function returns another xyzTD array filled with the interpolated
  20. points which define the curve.  Parameters can be used to control
  21. how many interpolating points are computed, and to fine-tune the
  22. shape of a curve.
  23.  
  24.  
  25. The spline points can be used to draw a curve, as a path for an
  26. animation object, as a contour for creating more complex 3D
  27. objects, and for many other applications that require smooth
  28. interpolations or transitions.
  29.  
  30.  
  31. The spline functions use the following parameters:
  32.  
  33.   Resolution   The number of interpolating points to use for each
  34.            curve segment.  The curves are composed of a number
  35.            of segments, each segment being associated with 4
  36.            adjacent control points.  The resolution parameter
  37.            specifies the number of line intervals that will be
  38.            used to approximate a curve segment.
  39.  
  40.                The resolution parameter affects the number of curve
  41.            points as follows:
  42.  
  43.                # points on entire curve
  44.                    = Resolution * ( # of control points - 1 ) + 1
  45.                    = Resolution * ( # of control segments ) + 1
  46.  
  47.            For example, A B spline with 4 control points and
  48.                resolution of 5 will have 3 segments, for a total
  49.                of 15 points on the curve.
  50.  
  51.  
  52.   Bias         Spline segments are controlled by a window of 4
  53.            control points.  Bias affects which control points
  54.            exert the most influence on the curve.  Different
  55.            types of splines use the bias parameters in different
  56.            ways.  The SplinApp.EXE program can be used to
  57.                demonstrate the effect of the bias parameter on
  58.                different curves.
  59.  
  60.  
  61.   Tension      The tension parameter affects how close the
  62.                spline curve is to its control polygon.  Increasing
  63.                the tension parameter will pull the curve closer to
  64.                the control polygon.
  65.  
  66.   Curve[]      The array of spline points filled in by the spline
  67.            function.  This is passed as a buffer to the spline
  68.            function, so it is up to the programmer to make sure
  69.            the array is big enough.
  70.  
  71.   Control[]    The array of control points used by the spline
  72.            function to compute the interpolating spline points.
  73.            This is referred to as the control polygon.
  74.  
  75.   NumControl   The integer number of control points in the
  76.                control polygon.
  77.  
  78.  
  79.  
  80. All the spline functions return the number of spline points computed.
  81.  
  82.  
  83.  
  84.  
  85. Splines can be defined in both 2D and 3D.  If you just need to work
  86. with 2D points, simply set the the Z component of each point to
  87. zero.
  88.  
  89.  
  90.  
  91. Support for using SPLINES.DLL with Visual Basic is distributed as
  92. the file SPLINES.BAS, which contains the necessary Type definitions
  93. and Declare statements.
  94.  
  95. Support for using SPLINES.DLL with C/C++ is provided through the
  96. files SPLINES.H and SPLINES.LIB.
  97.  
  98. SPLINES.DLL was compiled with Microsoft Visual C++.
  99.  
  100.  
  101.  
  102.  
  103. The following examples, in C and Visual Basic, create a control
  104. polygon of 4 points, and then create an interpolating B spline
  105. curve with 16 points.
  106.  
  107.  
  108.  
  109.  
  110.  
  111. C Example
  112.  
  113.   xyz_td Control[4];
  114.   xyz_td Curve[16];
  115.  
  116.   long lNumControls;
  117.   long lNumPoints;
  118.  
  119.  
  120.   Control[0].x =  0.0;
  121.   Control[0].y =  0.0;
  122.   Control[0].z =  0.0;
  123.  
  124.   Control[0].x = 10.0;
  125.   Control[0].y = 10.0;
  126.   Control[0].z =  0.0;
  127.  
  128.   Control[0].x = 20.0;
  129.   Control[0].y = 10.0;
  130.   Control[0].z =  0.0;
  131.  
  132.   Control[0].x = 30.0;
  133.   Control[0].y =  0.0;
  134.   Control[0].z =  0.0;
  135.  
  136.   /* Create a normal Bspline (tension = 1.0) */
  137.  
  138.   lNumPoints = Bspline(5, 1.0, 4, Control, Curve );
  139.  
  140.  
  141.   /* The Curve is now been filled with the points:
  142.      i   Curve[i].x    Curve[i].y    Curve[i].z
  143.  
  144.      0      0            0               0
  145.      1      2            1.98            0
  146.      2      4            3.89            0
  147.      3      6            5.64            0
  148.      4      8            7.15            0
  149.      5     10            8.33            0
  150.      6     12            9.13            0
  151.      7     14            9.53            0
  152.      8     16            9.53            0
  153.      9     18            9.13            0
  154.     10     20            8.33            0
  155.     11     22            7.15            0
  156.     12     24            5.64            0
  157.     13     26            3.89            0
  158.     14     28            1.99            0
  159.     15     30            0               0
  160.  
  161.   */
  162.  
  163.  
  164.  
  165. VB Example
  166. ----------
  167.  
  168.   Dim xyzTD        As Control[4]
  169.   Dim xyzTD        As Curve[16]
  170.  
  171.   Dim lNumControls As Long
  172.   Dim lNumPoints   As Long
  173.  
  174.  
  175.   Control(0).fX =  0.0
  176.   Control(0).fY =  0.0
  177.   Control(0).fZ =  0.0
  178.  
  179.   Control(0).fX = 10.0
  180.   Control(0).fY = 10.0
  181.   Control(0).fZ =  0.0
  182.  
  183.   Control(0).fX = 20.0
  184.   Control(0).fY = 10.0
  185.   Control(0).fZ =  0.0
  186.  
  187.   Control(0).fX = 30.0
  188.   Control(0).fY =  0.0
  189.   Control(0).fZ =  0.0
  190.  
  191.   ' Create a normal Bspline (tension = 1.0)
  192.  
  193.   lNumPoints = Bspline(5, 1.0, 4, Control(0), Curve(0))
  194.  
  195.  
  196.   ' The Curve is now been filled with the points:
  197.   '   i   Curve(i).x    Curve(i).y    Curve(i).z
  198.   '
  199.   '   0      0            0               0
  200.   '   1      2            1.98            0
  201.   '   2      4            3.89            0
  202.   '   3      6            5.64            0
  203.   '   4      8            7.15            0
  204.   '   5     10            8.33            0
  205.   '   6     12            9.13            0
  206.   '   7     14            9.53            0
  207.   '   8     16            9.53            0
  208.   '   9     18            9.13            0
  209.   '  10     20            8.33            0
  210.   '  11     22            7.15            0
  211.   '  12     24            5.64            0
  212.   '  13     26            3.89            0
  213.   '  14     28            1.99            0
  214.   '  15     30            0               0
  215.   '
  216.   '
  217.